<html>
<head>
<meta http-equiv='Content-Type' content='text/html; charset=utf-8'>
<title>栏目管理 -- 增加子栏目</title>
<link type="text/css" rel="stylesheet" href="main.css"/>
<script src="jquery.js" language="javascript" type="text/javascript"></script>
<script src="base.js" language="javascript" type="text/javascript"></script>

<style>
.exshow {
	background:url(img/tbody_toggle.gif) 0 -15px no-repeat;
	width:50px;
	height:15px;
	font-size:0px;
	color:#fafafa;
	cursor:pointer;
}
.exhide {
	background:url(img/tbody_toggle.gif) no-repeat;
	width:50px;
	height:15px;
	font-size:0px;
	color:#fafafa;
	cursor:pointer;
}
.ctbody {
	
}
a.exbody {
	color:#fafafa;
}
.fl {
	float:left;
}
</style>
<script language="javascript" src="../images/js/j.js"></script>
<script language="javascript">
var channelArray = new Array();
<?php
$i = 0;
foreach($channelArray as $k=>$arr)
{
echo "channelArray[$k] = \"{$arr['nid']}\";\r\n";
}
?>
/*$(document).ready(function(){
    var channelid=$("select[@id='channeltype'] option[@selected]").val();
	if( channelid == "6") {
    $("#tempindex").attr("value",'{style}/index_product.htm');
	$("#templist").attr("value",'{style}/list_product.htm');
	$("#temparticle").attr("value",'{style}/article_product.htm');
	}else{
	$("#tempindex").attr("value",'{style}/index_article.htm');
	$("#templist").attr("value",'{style}/list_article.htm');
	$("#temparticle").attr("value",'{style}/article_article.htm'); 
	}   	
}); 	*/
$(function(){
	ExbodyClick();
	$("#ispartct > :radio").click(function()
	{
		if(this.value=='2') {
			$('#predir').hide();
			$('#urlmsg').show();
		}
		else {
			$('#predir').show();
			$('#urlmsg').hide();
		}
	});
});
function ExbodyClick()
{
	$("a.exbody").click(function(){
  	if( $("tr.ctbody").get(0).style.display=="none") {
  		$(".ctbody").show();
  		$(".exbody div").get(0).className="exhide";
  	}
  	else {
  		$(".ctbody").hide();
  		$(".exbody div").get(0).className="exshow";
  	}
	});
}
function ShowHideHelp(spanid)
{
	if( $("#"+spanid).get(0).style.display=="none") {
		$("#"+spanid).show();
	} else {
		$("#"+spanid).hide();
	}
}

function SelectTemplets(fname) {
   if(document.all){
     var posLeft = window.event.clientY-100;
     var posTop = window.event.clientX-400;
   }
   else{
     var posLeft = 100;
     var posTop = 100;
   }
   window.open("../include/dialog/select_templets.php?f="+fname, "poptempWin", "scrollbars=yes,resizable=yes,statebar=no,width=600,height=400,left="+posLeft+", top="+posTop);
}

function ShowHide(objname) {
  if(obj.style.display != "none") $("#"+objname).hide();
  else $("#"+objname).show();
}

function ShowObj(objname) {
   $("#"+objname).show();
}

function HideObj(objname) {
  $("#"+objname).hide();
}

function CheckTypeDir() {
  var upinyin = document.getElementById('upinyin');
  var tpobj = document.getElementById('typedir');
  if(upinyin.checked) tpobj.style.display = "none";
  else tpobj.style.display = "block";
}

function checkSubmit()
{
   if(document.form1.typename.value=="")
   {
		  alert("栏目名称不能为空！");
		  document.form1.typename.focus();
		  return false;
	 }
	 return true;
}


function ParTemplet(obj)
{
  var sevvalue = channelArray[obj.value];
  var tempindex = document.getElementsByName('tempindex');
  var templist = document.getElementsByName('templist');
  var temparticle = document.getElementsByName('temparticle');
  var dfstyle = document.getElementsByName('dfstyle');
  var dfstyleValue = dfstyle[0].value;
  tempindex[0].value = dfstyleValue+"/{lang}/index_"+sevvalue+".htm";
  templist[0].value = dfstyleValue+"/{lang}/list_"+sevvalue+".htm";
  temparticle[0].value = dfstyleValue+"/{lang}/article_"+sevvalue+".htm";
  if(obj.value < 0)
  {
  	if(Nav()=='IE') tobj.style.display = "block";
	  else tobj.style.display = "table-row";
  }
  else
  {
  	tobj.style.display = "none";
  }
}
</script>

<script language="javascript"> 
function setTab(name,cursel,n){
 for(i=1;i<=n;i++){
  var menu=document.getElementById(name+i);
  var con=document.getElementById("con_"+name+"_"+i);
  menu.className=i==cursel?"hover":"";
  con.style.display=i==cursel?"block":"none";
 }
}
</script> 
<style>
.tabbox{
width:260px;
height:30px;
}
.tabbox li{text-align:center;display:block;cursor:pointer;width:80px;height:30px;line-height:30px;background:url(img/itemnote1.gif) repeat-x;	font-size:12px;color:#006600;font-weight:bold;float:left;}
.tabbox .hover{width:80px;background:url(img/itemnote2.gif) repeat-x;height:29px;line-height:29px;}
</style>
</head>
<body>
<div class="mtitle">
  <div class="lbox">栏目管理</div>
</div>
<table class="tform">
  <tbody>
    <tr>
      <td align="left"><IMG height=14 src="img/book1.gif" width=20>
       &nbsp;<a href="catalog_main.php"><strong>栏目管理</strong></a> &gt;&gt; <strong>增加子栏目</strong></td>
      <td align="right">
      </td>
    </tr>
  </tbody>
</table>
<div class="tabbox">
<ul>
<li id="two1" class="hover"  onclick="setTab('two',1,3)"> 修改栏目</li>
<li id="two2"  onclick="setTab('two',2,3)"> 模板管理</li>
<li id="two3"  onclick="setTab('two',3,3)"> 高级选项</li>
</ul>
</div>
<form name="form1" action="catalog_add.php" method="post" onSubmit="return checkSubmit();">
  <input type="hidden" name="dopost" value="save" />
  <input type="hidden" name="reid" id="reid" value="<?php echo $id; ?>" />
  <input type='hidden' name='topid' id='topid' value='<?php echo ($topid==0 ? $id : $topid); ?>' />
  <input type='hidden' name='lang' id='lang' value='<?php echo $lang; ?>' />
  <input type='hidden' name='isdefault' id='isdefault' value='<?php echo $isdefault; ?>' />
<table class="tform"  id="con_two_1">
<tbody>
      <tr>
      <th colspan="2"><strong>必选项目</strong></th>
      </tr>
      <tr>
            <td class='bline' width="20%" height="26"><strong><font color='red'>&nbsp;内容模型：</font></strong></td>
            <td class='bline' width="80%">
            	
           <select name="channeltype" id="channeltype" style="width:200px"  onChange="ParTemplet(this)">
            <?php
            foreach($channelArray as $k=>$arr)
            {
            	if($k==$channelid) {
            		$nid = $arr['nid'];
            		echo "    <option value='{$k}' selected>{$arr['typename']}|{$arr['nid']}</option>\r\n";
              }
              else
              {
              	  echo "    <option value='{$k}'>{$arr['typename']}|{$arr['nid']}</option>\r\n";
          }
            }
            ?>
              </select>            <input type='hidden' value='{style}' name='dfstyle' class="pubinputs" />   </td>
      </tr>
      <tr>
            <td class='bline' height="26"><strong><font color='red'>&nbsp;栏目名称：</font></strong></td>
            <td class='bline'><input name="typename" type="text" id="typename" size="30" class="txt" /></td>
    </tr>
       <tr>
            <td height="26" class='bline'><strong> &nbsp;排列顺序： </strong></td>
            <td class='bline'><input name="sortrank" size="6" type="text" value="50" class="txt" style="width:60px" />
              （由低 -&gt; 高） </td>
       </tr>
       <tr>
            <td height="26" class='bline'><strong>&nbsp;文件保存目录：</strong></td>
            <td class='bline'>
            	<table border="0" cellspacing="1" cellpadding="1">
                <tr>
                  <td>
            <span id='urlmsg' style='display:none'><strong>请输入要转向的网址：</strong></span>
            <span id='predir'>
            <?php
            $pardir = '{cmspath}'.$cfg_arcdir;
            if(!empty($typedir)) $pardir = $typedir.'/';
            $pardir = ereg_replace('/{1,}','/',$pardir);
            echo $pardir;
          ?></span>
                  <input name="nextdir" type="hidden" id="nextdir" value="<?php echo $pardir?>" />
                   <input name="referpath" type="hidden" id="truepath1" class="np" value="parent" />
                  	<input name="typedir" type="text" id="typedir" class="txt" style="width:200px">                  </td>
                  <td>
                  <input name="upinyin" type="checkbox" id="upinyin" class="np" value="1" onClick="CheckTypeDir()" />
                  拼音                  </td>
                </tr>
              </table>
              </td>
        </tr>
        <tr>
            <td height="26" class='bline'>&nbsp;<strong>文 件 名：</strong></td>
            <td class='bline'><input name="defaultname" type="text" class="txt" id="defaultname" value="index.html" size="30" />
              <strong>(非单独内容页不要修改此项)</strong>
            </td>
        </tr>
        <tr>
            <td height="26" class='bline'><strong>&nbsp;栏目属性：</strong></td>
            <td class='bline' id='ispartct'>
            	<input name="ispart" type="radio" id="radio1" value="0" class='np' checked />
              最终列表栏目（允许在本栏目发布文档，并生成文档列表） <br>
              <input name="ispart" type="radio" id="radio2" value="1" class='np'/>
              频道封面（栏目本身不允许发布文档） <br>
              <input name="ispart" type="radio" id="radio3" value="3" class='np'/>
              仅为单独内容页（关于我们、公司简介之类） <br>
              <input name="ispart" type="radio" id="radio4" value="2" class='np'/>
              外部连接（在"文件保存目录"处填写网址） 
            </td>
        </tr>
		     <tr class='ctbody'>
            <td class='bline'>
            	<strong>&nbsp;页面内容：</strong>            </td>
			      <td class='bline'>
			      	(栏目页面内容是栏目模板中直接调用的HTML信息，调用标签为{dede:field name='content' /})			      </td>
        </tr>
        <tr class='ctbody'>
            <td colspan="2">
            	<?php
	            GetEditor("content","","450","Default","print","false");
	            ?>
	          </td>
      </tr>
        </tbody>
		</table>
		
			<table class="tform" id="con_two_2" style="display:none">
         <tbody>
      <tr>
        <th colspan="2" ><strong>模板管理</strong></th>
      </tr>
	    <tr>
            <td height="26" class='bline'>&nbsp;<strong>频道封面模板：</strong></td>
            <td class='bline'><input name="tempindex" type="text" class="txt" id="tempindex" style="width:250px" value="{style}/{lang}/index_<?php echo $nid?>.htm" size="30" class="pubinputs"/><button type="button" name="set3" class="btn1s" style="width:60px" onClick="SelectTemplets('form1.tempindex');" />浏览...</button>
              <strong>(若为空，则默认为:index_article.htm)</strong>
            </td>
        </tr>
		   <tr>
            <td height="26" class='bline'>&nbsp;<strong>列表模板：</strong></td>
            <td class='bline'><input name="templist" type="text" class="txt" id="templist" style="width:250px" value="{style}/{lang}/list_<?php echo $nid?>.htm" size="30" class="pubinputs"/><button type="button" name="set3" class="btn1s" style="width:60px" onClick="SelectTemplets('form1.templist');" />浏览...</button>
              <strong>(若为空，则默认为:list_article.htm)</strong>
            </td>
        </tr>
				   <tr>
            <td height="26" class='bline'>&nbsp;<strong>文章模板：</strong></td>
            <td class='bline'><input name="temparticle" type="text" class="txt" id="temparticle" style="width:250px" value="{style}/{lang}/article_<?php echo $nid?>.htm" size="30"class="pubinputs" />  <button type="button" name="set4"  class="btn1s" style="width:60px" onClick="SelectTemplets('form1.temparticle');"/>浏览...</button>
             
            </td>
        </tr>
          
           <tr>
            <td height="26" class='bline'>&nbsp;<strong>单页模板：</strong></td>
            <td class='bline'><input name="tempsgpage" type="text" class="txt" id="tempsgpage" style="width:250px" value="{style}/{lang}/catalog_sgpage.htm" size="30" class="pubinputs" /><button type="button" name="set4"  class="btn1s" style="width:60px" onClick="SelectTemplets('form1.tempsgpage');"/> 浏览...</button>
             
            </td>
        </tr>
		        <tr>
            <td height="26" class='bline'>&nbsp;<strong>文章命名规则：</strong></td>
            <td class='bline'><input name="namerule" type="text" class="txt" id="namerule" style="width:250px" value="{typedir}/{Y}{M}{D}{aid}.html" size="30" class="pubinputs" />
            
            </td>
        </tr>
   <tr>
            <td height="26" class='bline'>&nbsp;<strong>分页命名规则：</strong></td>
            <td class='bline'><input name="namerule2" type="text" class="txt" id="namerule2" style="width:250px" value="{typedir}/index-{tid}-{page}.html" size="30" class="pubinputs" />
            
            </td>
        </tr>
        </tbody>
		</table>
		<table  class="tform" id="con_two_3" style="display:none">
        <tbody>
        <tr>
			<th colspan="2"><strong>高级内容</strong></th>
		</tr>
		  <tr>
            <td height="26" class='bline'>&nbsp;<strong>是否隐藏栏目：</strong></td>
            <td class='bline'><input type='radio' name='ishidden' value='0' class='np' checked="checked" />
              显示　&nbsp;
              <input type='radio' name='ishidden' value='1' class='np' />
              隐藏
             
            </td>
        </tr>
<tr>
            <td height="26" class='bline'>&nbsp;<strong>栏目类型：</strong></td>
            <td class='bline'><input type='radio' name='isdefault' value='1' class='np' checked="checked" />
            静态　
            &nbsp;
              <input type='radio' name='isdefault' value='-1' class='np' />
              动态
             
            </td>
        </tr>
<!--  <tr>
            <td height="26" class='bline'>&nbsp;<strong>目标打开方式：</strong></td>
            <td class='bline'><input type='radio' name='target' value='' class='np' checked="checked" />
              本窗口　&nbsp;
              <input type='radio' name='target' value='target=_blank' class='np' />
              新窗口
             
            </td>
        </tr> -->
        <tr class='ctbody'>
            <td height="65"  class='bline'><strong>&nbsp;关 键 字：</strong></td>
            <td  class='bline'>
            	<input type="input" name="keywords" id="keywords" class="txt" style="width:420px" />            </td>
        </tr>
        <tr class='ctbody'>
            <td height="65"  class='bline'><strong>&nbsp;页面摘要：</strong></td>
            <td height="65"  class='bline'> <textarea name="description" cols="70" rows="4" id="description" class="txt" style="width:420px;height:60px"></textarea></td>
        </tr>
   
      </tbody>
    </table>
    
    <table width="98%" border="0" cellspacing="0" cellpadding="0">
		  <tr>
            <td width="1%" height="50"></td>
            <td width="99%" valign="bottom">
 <button type="submit" class="btn1">确定</button>
&nbsp;&nbsp;&nbsp;
           <button type="button" class="btn1" onClick="location='catalog_main.php';">返回</button>
			</td>
    </tr>
  </table>
</form>
</body>
</html>
